<%@ page import="com.igeek.compus.backend.entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
</head>
<body>

<%
    // 校验登陆，获得session中的user，如果没有，则未登陆，跳转至登陆页面
    Object user = session.getAttribute("user");
    if(user == null) {
        request.getRequestDispatcher("login.jsp").forward(request, response);
    }
%>

<h1>首页</h1>

<h1 style="color:green">request请求域：欢迎<%= request.getAttribute("user") %>登陆</h1>
<h1 style="color:blue">session请求域：欢迎<%= session.getAttribute("user") %>登陆</h1>
<h1 style="color:blue">您是第<%= application.getAttribute("count")%>个登陆系统</h1>

<a href="home2.jsp">跳转至home2页面</a><br>
<a href="user?code=logout">安全退出</a>

</body>
</html>
